import request from "@/utils";

// 获取学生数据接口
export const getStuAPI = () => {
  return request({
    url: "/api/stus",
    method: "get",
  });
};

// 添加学生数据接口
export const addStuAPI = ({ grade, major, name, sex, age }) => {
  return request({
    url: "/api/addStu",
    method: "post",
    data: {
      grade,
      major,
      name,
      sex,
      age,
    },
  });
};

// 修改学生数据接口
export const updateStuAPI = ({ id, grade, major, name, sex, age }) => {
  return request({
    url: "/api/updateStu",
    method: "post",
    data: {
      id,
      grade,
      major,
      name,
      sex,
      age,
    },
  });
};

// 删除学生数据接口
export const delStuAPI = (id) => {
  return request({
    url: "/api/delStu/" + id,
    method: "get",
  });
};
